@charset "UTF-8";

// Built-in modules
@use "sass:color";
@use "sass:list";
@use "sass:map";
@use "sass:math";
@use "sass:meta";
@use "sass:selector";
@use "sass:string";

// Mixkit settings and modules
@use "mixkit/settings" as settings;
@use "mixkit/shorthand" as shorthand;
@use "mixkit/validate" as validate;

/// Configure element positioning.
///
/// @name position|pos
///
/// @group mixkit/properties
///
/// @param {list} $position
///   A valid CSS position
///
/// @param {list} $shorthand
///   CSS shorthand; directional.
///
/// @output CSS rules.
///
/// @require {function (mixkit/shorthand)} define
///
/// @require {function} validate.is-length
///
/// @access public
///
/// @since 1.0.0

@mixin position($position, $shorthand) {
  $shorthand: shorthand.define(list, $shorthand);
  $offsets: (
    "top": list.nth($shorthand, 1),
    "right": list.nth($shorthand, 2),
    "bottom": list.nth($shorthand, 3),
    "left": list.nth($shorthand, 4),
  );
  position: $position;
  @each $offset, $value in $offsets {
    @if validate.is-length($value) {
      #{$offset}: $value;
    }
  }
}

// Alias
@mixin pos($args...) {
  @include position($args...);
}
